package org.massdgames.thunder.server.domain.strategy;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

import org.massdgames.thunder.server.domain.Card;
import org.massdgames.thunder.server.domain.CardType;
import org.massdgames.thunder.server.domain.Deck;

public class BasicHeroLoadStrategy implements HeroLoadStrategy {

    public Deck load(Deck deck) throws IOException {
        Properties properties = new Properties();
        properties.load(new FileInputStream("deck.properties"));
        int heroCount = new Integer(properties.getProperty("hero.count"));

        for (int i = 0; i < heroCount; i++) {
            Card heroCard = new Card();
            heroCard.setCardId(i);
            heroCard.setName(properties.getProperty("hero." + i + ".name"));
            heroCard.setCardType(CardType.HERO);
            deck.addCard(heroCard);
        }
        return deck;
    }

}
